﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;
using Telerik.Windows.Controls;
using FarmacieDAL;

namespace Farmacie.Windows
{
    /// <summary>
    /// Interaction logic for RetetaWindow.xaml
    /// </summary>
    public partial class RetetaWindow : RadWindow
    {
        private Chitanta chitanta;

        public RetetaWindow(Chitanta chitanta)
        {
            InitializeComponent();
            buttonOK.Click += new RoutedEventHandler(buttonOK_Click);
            buttonCancel.Click += new RoutedEventHandler(buttonCancel_Click);
            this.chitanta = chitanta;

            if (chitanta.Reteta == null)
            {
                chitanta.Reteta = new Reteta();
            }

            retetaControl.Reteta = chitanta.Reteta;
        }

        void buttonCancel_Click(object sender, RoutedEventArgs e)
        {
            chitanta.Reteta = null;
            this.Close();
        }

        void buttonOK_Click(object sender, RoutedEventArgs e)
        {
            chitanta.Reteta = retetaControl.Reteta;
            this.Close();
        }
    }
}
